import turtle
import turtle as t

t.setup(800, 800, 0, 0)
t.speed(3)
t.penup()
t.goto(-50, -95)
t.pendown()


def fun1(t, x, y):
    t.forward(x)
    t.left(y)


def fun2(t, x, y):
    t.forward(x)
    t.right(y)


# color函数有三个参数
t.color(1, 0, 0)

t.begin_fill()
fun1(t, 46, 90)
fun1(t, 10, 90)
fun2(t, 6, 60)
fun1(t, 8, 60)
fun1(t, 26, 60)
fun2(t, 8, 60)
fun1(t, 6, 90)
fun1(t, 10, 90)
t.end_fill()
t.color(0, 0, 0)
# 车轮
t.up()
fun2(t, 8, 90)
t.fd(5)
t.down()
t.begin_fill()
t.circle(5)
t.end_fill()

# 设置当前的指定角度为0度
t.setheading(0)
t.up()
fun2(t, 24, 90)
t.fd(5)
t.down()
t.begin_fill()
t.setheading(0)
t.circle(5)
t.end_fill()

# 车窗
t.pu()
t.goto(-18, 10)
t.pd()

t.begin_fill("snow")
t.fillcolor()
for i in range(4):
    t.fd(3)
    t.left(90)
t.end_fill()
t.done()
